"""第 0009 题：一个 HTML 文件，找出里面的链接。"""
from lxml import etree


def get_html_all_link(html):
    """获取所有链接"""
    with open(html, encoding="UTF-8") as f:
        tree = etree.HTML(f.read())
    links = tree.xpath("//a/@href[contains(., 'http')]")
    for i, link in enumerate(links):
        print(i, link)


get_html_all_link('test.html')
